//
//  RBInvoiceHeaderListCell.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/11.
//

#import "RBInvoiceHeaderListCell.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RanTool.h"

@interface RBInvoiceHeaderListCell()

@property(nonatomic, strong)IBOutlet UILabel *nameL;
@property(nonatomic, strong)IBOutlet UILabel *taxL;
@property(nonatomic, strong)IBOutlet UIImageView *defaultImgView;
@property(nonatomic, strong)IBOutlet UILabel *defaultL;

@property (nonatomic, strong) RBCellModel *cellModel;

@end

@implementation RBInvoiceHeaderListCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self zoomSubViewsWithSelf];
}

- (void)setCellModel:(RBCellModel *)cellModel
{
    _cellModel = cellModel;
    RBInvoiceHeaderManageModel *model = cellModel.cellData;
    //公司名称
    self.nameL.text = model.company_name;
    //公司税号
    self.taxL.text = [NSString stringWithFormat:@"税号：%@", model.company_shui];
    //默认
    if ([model.is_default isEqualToString:@"1"]) {
        self.defaultImgView.image = [self selImg];
        self.defaultL.textColor = [RBThemeConfig buttonBlueColor];
    } else {
        self.defaultImgView.image = [self norImg];
        self.defaultL.textColor = [RBThemeConfig textLightGrayColor];

    }
}

- (IBAction)deleteBtnTapped:(id)sender
{
    RBInvoiceHeaderManageModel *model = self.cellModel.cellData;
    if (self.cellModel.eventBlock1)
    {
        self.cellModel.eventBlock1(1, 0, model);
    }
}

- (IBAction)editBtnTapped:(id)sender
{
    RBInvoiceHeaderManageModel *model = self.cellModel.cellData;
    if (self.cellModel.eventBlock1)
    {
        self.cellModel.eventBlock1(2, 0, model);
    }
}

- (UIImage *)selImg
{
    return [UIImage imageNamed:@"addressListDefault"];
}

- (UIImage *)norImg
{
    return [UIImage imageNamed:@"unsel"];
}

@end
